import { useTreeStore } from "~/utils/pinia/tree.js";

export const strategyFn = () => {
  const treeStore = useTreeStore();
  const strategyType = treeStore.treeStrategyTypeList
  let menuName = document.getElementsByClassName("el-menu-item is-active")[0]
    ? document.getElementsByClassName("el-menu-item is-active")[0].innerText : ''
  let tabsName = document.getElementsByClassName("el-tabs__item is-top is-active")[0]
    ? document.getElementsByClassName("el-tabs__item is-top is-active")[0].innerText : ''
  if (menuName == '安全基线' && (tabsName == '账户策略' || tabsName == '审核策略' || tabsName == '安全选项')) {
    tabsName = ''
  }
  let strategyName
  if (tabsName != ''&& menuName != '') {
    strategyName = menuName +'-'+ tabsName
  } else if (tabsName == ''&& menuName != '') {
    strategyName = menuName
  }
  let type
  for(var k in strategyType) {
    if (strategyName === strategyType[k]) {
      type = k
    }
  }
  return type
}
